home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1423 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: hubcap.clemson.edu!usenet
  2. From: Stephane Morvan <smorvan@eng.clemson.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: istream/fstream problem with binary data on Unix system
  5. Date: 10 Jan 1996 22:27:29 GMT
  6. Organization: Clemson University
  7. Message-ID: <4d1egh$fts@hubcap.clemson.edu>
  8. NNTP-Posting-Host: snowwhite.eng.clemson.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1IS (X11; I; IRIX 5.3 IP19)
  13. X-URL: news:comp.lang.c++
  14.  
  15. I can't properly extract 50 bytes of raw binary data from a file...
  16. Eventhough I "unsetf" ios::skipws.
  17. The data to read looks like that:
  18. 12 floats + 2 bytes (pad) = 48 bytes + 2 bytes = 50 bytes.
  19. What I'm doing:
  20. float  data[13];
  21. fstream myfile("data", ios::in, streambuf::openprot);
  22. myfile.get((char *)data, 50);
  23. the binary data looks unproperly transfered to its recipient. 
  24. The same file is working fine with a C program.
  25. Any help would be welcome...
  26.  
  27.  
  28. -- 
  29. Stephane Morvan
  30.  
  31.  
  32. *************************************************************************
  33. *           Clemson Design Methodology Group             *
  34. *                                     *
  35. * Home         : (803)-639-3755  Office : (803)-656-7176         *
  36. * e-mail     : smorvan@eng.clemson.edu                 *
  37. * WWW         : http://www.eng.clemson.edu/dmg/people/morvan.html     *
  38. *                                     *
  39. *************************************************************************
  40.  
  41.